package com.blog.cloud.security.bo;

import com.blog.cloud.api.vo.auth.UserInfoVO;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;
import java.util.Set;

@Getter
@Setter
public class UserInfo extends User {

    private UserInfoVO userInfoVO;

    /**
     * 在认证后的用户信息中添加角色用于登录时根据角色设置登录过期时间
     */
    private Set<String> roles;

    public UserInfo(String username, String password, UserInfoVO userInfoVO,Set<String> roles, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.userInfoVO = userInfoVO;
        this.roles = roles;
    }

}
